<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .number-container {
            overflow: hidden;
            display: inline-block;
            line-height: 1.5;
        }

        .number {
            display: block;
            animation: scroll-number 3s infinite alternate ease-in-out;
            /* 调整数值改变滚动速度 */
        }

        @keyframes scroll-number {

            0%,
            100% {
                transform: translateY(0);
            }

            0% {
                color: red;
            }

            50% {
                color: blue;
            }
        }
    </style>
</head>

<body>
    <div class="number-container">
        <div class="number" data-value="50">50</div>
    </div>
</body>

</html>